package project2;

public class Test {
    public static void main(String[] args){
        int[] tests = new int[]{10,1,20000,500,1000,2000,5000,8000,100000,200000};
        System.out.println("对插入排序的测试");
        for(int time=0; time < 10;time++) {
            int[] a = new int[tests[time]];
            for (int i = 0; i < tests[time]; i++)
                a[i] = (int) (Math.random() * 1000);
            long start_time = System.nanoTime();
            new Insertion().sort(a);
            long consumingtime = System.nanoTime() - start_time;
            System.out.println("第"+(1+time)+"次"+"排序时间时间：" + consumingtime/1000 + "us");
        }
        System.out.println("对自顶向下归并排序的测试");
        for(int time=0; time < 10;time++) {
            int[] a = new int[tests[time]];
            for (int i = 0; i < tests[time]; i++)
                a[i] = (int) (Math.random() * 1000);
            long start_time = System.nanoTime();
            new TDM().sort(a);
            long consumingtime = System.nanoTime() - start_time;
            System.out.println("第"+(1+time)+"次"+"排序时间时间：" + consumingtime/1000 + "us");
        }
        System.out.println("对自底向上归并排序的测试");
        for(int time=0; time < 10;time++) {
            int[] a = new int[tests[time]];
            for (int i = 0; i < tests[time]; i++)
                a[i] = (int) (Math.random() * 1000);
            long start_time = System.nanoTime();
            new BUM().sort(a);
            long consumingtime = System.nanoTime() - start_time;
            System.out.println("第"+(1+time)+"次"+"排序时间时间：" + consumingtime/1000 + "us");
        }
        System.out.println("对快速排序的测试");
        for(int time=0; time < 10;time++) {
            int[] a = new int[tests[time]];
            for (int i = 0; i < tests[time]; i++)
                a[i] = (int) (Math.random() * 1000);
            long start_time = System.nanoTime();
            new RQ().sort(a);
            long consumingtime = System.nanoTime() - start_time;
            System.out.println("第"+(1+time)+"次"+"排序时间时间：" + consumingtime/1000 + "us");
        }
        System.out.println("对迪杰斯特拉3路划分的测试");
        for(int time=0; time < 10;time++) {
            int[] a = new int[tests[time]];
            for (int i = 0; i < tests[time]; i++)
                a[i] = (int) (Math.random() * 1000);
            long start_time = System.nanoTime();
            new QD3P().sort(a,0,a.length-1);
            long consumingtime = System.nanoTime() - start_time;
            System.out.println("第"+(1+time)+"次"+"排序时间时间：" + consumingtime/1000 + "us");
        }
    }
}
